<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws.
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.).
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations).
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/modules/Blog/classes/PhpFox_ComponentMyPageBlogView.class.php, $Author:  $ */



/** Component for viewing any blog in member page
 *
 * @version $Id: PhpFox_ComponentMyPageBlogView.class.php 361 2008-02-21 14:05:20Z root $
 * @package module.blog
 */
class PhpFox_Mod_Blog_ComponentMyPageBlogView extends BaseComponent
{
    function process()
    {
        $oBlogItem = $this->_oModule->getItem('Blog');
        /* @var $oBlogItem PhpFox_Mod_Blog_ItemBlog */
        $oSecurityService = App::getModuleService('Account', 'Security');
        /* @var $oSecurityService PhpFox_Mod_Account_ServiceSecurity */
        $oReq = &App::getRequest();
        $oTpl = $this->_oModule->getTemplate();

        $oSecurityService->checkPerm('blog', array('read_only', 'full'));
        $oSecurityService->checkAccess('blogs');
        if (!$iId = $oReq->getInt('id'))
        {
        	App::gotoUrl('public.blog.main');
        }
		$sUser = $oReq->get('name');
        if (!$oBlogItem->load($iId))
        {
            App::gotoUrl('public.user.blogs');
        }
        $oBlogItem->aData['user'] = $sUser;
        $oTpl->assignSrc('aItem', $oBlogItem->aData);
        return $oTpl->fetch('MyPageBlogView.html');
    }
}
?>